package task.config;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

/**
 * 
 * @author Daniil Chivilikhin
 *
 */
public class AbstractAutomatonTaskConfig {
	private Properties properties;
	
	public AbstractAutomatonTaskConfig(String configFileName) {
		try {
			properties = new Properties();
			properties.load(new FileInputStream(new File(configFileName)));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public String getProperty(String propertyName) {
		return properties.getProperty(propertyName);
	}
	
	public String className() {
		return properties.getProperty("class-name");
	}
	
	public int desiredNumberOfStates() {
		return Integer.parseInt(properties.getProperty("desired-number-of-states"));
	}
	
	public double desiredFitness() {
		return Double.parseDouble(properties.getProperty("desired-fitness"));
	}
	
	public double minimumFitness() {
		return Double.parseDouble(properties.getProperty("minimum-fitness"));
	}
}
